package collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

//增强for循环
public class NewForDemo {
    public static void main(String[] args) {
        String[]array={"one","two","three","four","five"};
//        for (int i=0;i<array.length;i++){
//            System.out.println(array[i]);
//}              新循环
        for(String str:array){
            System.out.println(str);

        }
        Collection i=new ArrayList();
        i.add("one");
        i.add("two");
        i.add("three");
        i.add("four");
        i.add("five");
        Iterator it=i.iterator();
        for( Object c:i){
            String str=(String) c;
            System.out.println(str);
        }
        //        while (it.hasNext()){
//            String SAT=(String)it.next() ;
//            System.out.println(SAT);
//
//        }
//


    }
}
